package orderclient

import (
	"context"
	"github.com/cloudwego/kitex/client/callopt"
	"github.com/cloudwego/kitex/pkg/klog"
	order "order/kitex_gen/order"
)

func AddOrder(ctx context.Context, req *order.AddOrder, callOptions ...callopt.Option) (resp *order.AddOrder, err error) {
	resp, err = defaultClient.AddOrder(ctx, req, callOptions...)
	if err != nil {
		klog.CtxErrorf(ctx, "AddOrder call failed,err =%+v", err)
		return nil, err
	}
	return resp, nil
}

func DeleteOrder(ctx context.Context, req *order.DeleteOrder, callOptions ...callopt.Option) (resp *order.DeleteOrder, err error) {
	resp, err = defaultClient.DeleteOrder(ctx, req, callOptions...)
	if err != nil {
		klog.CtxErrorf(ctx, "DeleteOrder call failed,err =%+v", err)
		return nil, err
	}
	return resp, nil
}

func GetOrder(ctx context.Context, req *order.GetOrder, callOptions ...callopt.Option) (resp *order.GetOrder, err error) {
	resp, err = defaultClient.GetOrder(ctx, req, callOptions...)
	if err != nil {
		klog.CtxErrorf(ctx, "GetOrder call failed,err =%+v", err)
		return nil, err
	}
	return resp, nil
}

func UpdateOrder(ctx context.Context, req *order.UpdateOrder, callOptions ...callopt.Option) (resp *order.UpdateOrder, err error) {
	resp, err = defaultClient.UpdateOrder(ctx, req, callOptions...)
	if err != nil {
		klog.CtxErrorf(ctx, "UpdateOrder call failed,err =%+v", err)
		return nil, err
	}
	return resp, nil
}
